﻿@model List<Cd_Channel>
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>车辆管理系统</title>
    <link type="text/css" rel="stylesheet" href="/Scripts/easyui/themes/icon.css" />
    <link type="text/css" rel="stylesheet" href="/Content/adminstyle.css" />
    <link type="text/css" rel="stylesheet" href="/Scripts/easyui/themes/default/easyui.css" />
    <script type="text/javascript" src="/Scripts/jquery.js"></script>
    <script type="text/javascript" src="/Scripts/easyui/jquery.easyui.min.js"></script>
    <style type="text/css">
        body { font: 12px/20px "微软雅黑" , "宋体" , Arial, sans-serif, Verdana, Tahoma; padding: 0; margin: 0; }
        a:link { text-decoration: none; }
        a:visited { text-decoration: none; }
        a:hover { text-decoration: underline; }
        a:active { text-decoration: none; }
        .cs-north { height: 77px; }
        .cs-north-bg { width: 100%; height: 100%; background: url(/images/car/logo.jpg) no-repeat; position: relative; }
        .cs-north-logo { color: #fff; font-size: 14px; text-decoration: none; color: #000; position: absolute; bottom: 0; right: 10px; }
        .cs-west { width: 200px; padding: 0px; border-left: 1px solid #99BBE8; }
        .cs-south { height: 25px; padding: 0px; text-align: center; }
        .cs-navi-tab { padding: 5px; font-size: 13px; display: block; }
        .cs-navi-tab.current, .cs-navi-tab:hover { background: #E47506; color: #fff; text-decoration: none; }
        .cs-tab-menu { width: 120px; }
        .cs-home-remark { padding: 10px; }
    </style>
    <script type="text/javascript">
        function addTab(title, url) {
            if ($('#tabs').tabs('exists', title)) {
                $('#tabs').tabs('select', title); //选中并刷新
                var currTab = $('#tabs').tabs('getSelected');
                var url = $(currTab.panel('options').content).attr('src');
                if (url != undefined && currTab.panel('options').title != 'Home') {
                    $('#tabs').tabs('update', {
                        tab: currTab,
                        options: {
                            content: createFrame(url)
                        }
                    });
                }
            } else {
                var content = createFrame(url);
                $('#tabs').tabs('add', {
                    title: title,
                    content: content,
                    closable: true
                });
            }
            tabClose();
        }
        function createFrame(url) {
            var s = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
            return s;
        }

        function tabClose() {
            /*双击关闭TAB选项卡*/
            $(".tabs-inner").dblclick(function () {
                var subtitle = $(this).children(".tabs-closable").text();
                $('#tabs').tabs('close', subtitle);
            });
            /*为选项卡绑定右键*/
            $(".tabs-inner").bind('contextmenu', function (e) {
                $('#mm').menu('show', {
                    left: e.pageX,
                    top: e.pageY
                });

                var subtitle = $(this).children(".tabs-closable").text();

                $('#mm').data("currtab", subtitle);
                $('#tabs').tabs('select', subtitle);
                return false;
            });
        }
        //绑定右键菜单事件
        function tabCloseEven() {
            //刷新
            $('#mm-tabupdate').click(function () {
                var currTab = $('#tabs').tabs('getSelected');
                var url = $(currTab.panel('options').content).attr('src');
                if (url != undefined && currTab.panel('options').title != 'Home') {
                    $('#tabs').tabs('update', {
                        tab: currTab,
                        options: {
                            content: createFrame(url)
                        }
                    });
                }
            });
            //关闭当前
            $('#mm-tabclose').click(function () {
                var currtab_title = $('#mm').data("currtab");
                $('#tabs').tabs('close', currtab_title);
            });
            //全部关闭
            $('#mm-tabcloseall').click(function () {
                $('.tabs-inner span').each(function (i, n) {
                    var t = $(n).text();
                    if (t != 'Home') {
                        $('#tabs').tabs('close', t);
                    }
                });
            });
            //关闭除当前之外的TAB
            $('#mm-tabcloseother').click(function () {
                var prevall = $('.tabs-selected').prevAll();
                var nextall = $('.tabs-selected').nextAll();
                if (prevall.length > 0) {
                    prevall.each(function (i, n) {
                        var t = $('a:eq(0) span', $(n)).text();
                        if (t != 'Home') {
                            $('#tabs').tabs('close', t);
                        }
                    });
                }
                if (nextall.length > 0) {
                    nextall.each(function (i, n) {
                        var t = $('a:eq(0) span', $(n)).text();
                        if (t != 'Home') {
                            $('#tabs').tabs('close', t);
                        }
                    });
                }
                return false;
            });
            //关闭当前右侧的TAB
            $('#mm-tabcloseright').click(function () {
                var nextall = $('.tabs-selected').nextAll();
                if (nextall.length == 0) {
                    //msgShow('系统提示','后边没有啦~~','error');
                    alert('后边没有啦~~');
                    return false;
                }
                nextall.each(function (i, n) {
                    var t = $('a:eq(0) span', $(n)).text();
                    $('#tabs').tabs('close', t);
                });
                return false;
            });
            //关闭当前左侧的TAB
            $('#mm-tabcloseleft').click(function () {
                var prevall = $('.tabs-selected').prevAll();
                if (prevall.length == 0) {
                    alert('到头了，前边没有啦~~');
                    return false;
                }
                prevall.each(function (i, n) {
                    var t = $('a:eq(0) span', $(n)).text();
                    $('#tabs').tabs('close', t);
                });
                return false;
            });

            //退出
            $("#mm-exit").click(function () {
                $('#mm').menu('hide');
            });
        }

        $(function () {
            tabCloseEven();
            $('.cs-navi-tab').click(function () {
                var $this = $(this);
                var href = $this.attr('src');
                $(this).addClass("current").siblings().removeClass("current");
                var title = $this.text();
                addTab(title, href);
            });
        });
    </script>
</head>
<body class="easyui-layout">
    <div region="north" border="true" class="cs-north">
        <div class="cs-north-bg">
            <div class="cs-north-logo">
                欢迎您：<span class="red">[@ManagerContext.UserInfo.UserName]</span> <a href="@Url.Action("Index", "Home", new { area = "Car" })" target="_blank">
                    返回首页</a> <a href="@Url.Action("Logout", "Frame")">退出</a>
            </div>
        </div>
    </div>
    <div region="west" border="true" split="true" title="导航管理" class="cs-west">
        <div class="easyui-accordion" fit="true" border="false">
            @foreach (Channel m in Model.Where(p => p.ParentId == 0))
            {
                <div title="@m.Name">
                    @{
                int parentId = m.Id;
                    }
                    @foreach (var c in Model.Where(p => p.ParentId == parentId))
                    {
                        <a href="javascript:void(0)" src="@Url.Action(@c.ActionrField, @c.ControllerField)" class="cs-navi-tab">@c.Name</a>
                    }
                </div>
            }
        </div>
    </div>
    <div id="mainPanle" class="easyui-layout" style="overflow: visible;" region="center"
        border="false" border="false">
        <div id="tabs" class="easyui-tabs" fit="true" border="false">
            <div title="首页">
                <div class="cs-home-remark">
                    <h1 style="margin-bottom: 20px;">
                        管理系统</h1>
                    <table class="msgtable">
                        <tr>
                            <td>
                                服务器IP：
                            </td>
                            <td>
                                @Request.ServerVariables["LOCAL_ADDR"]
                            </td>
                        </tr>
                        <tr>
                            <td>
                                NET框架版本：
                            </td>
                            <td>
                                @Environment.Version.ToString()
                            </td>
                        </tr>
                        <tr>
                            <td>
                                操作系统：
                            </td>
                            <td>
                                @Environment.OSVersion.ToString()
                            </td>
                        </tr>
                        <tr>
                            <td>
                                IIS环境：
                            </td>
                            <td>
                                @Request.ServerVariables["SERVER_SOFTWARE"]
                            </td>
                        </tr>
                        <tr>
                            <td>
                                服务器端口：
                            </td>
                            <td>
                                @Request.ServerVariables["SERVER_PORT"]
                            </td>
                        </tr>
                        <tr>
                            <td>
                                目录物理路径：
                            </td>
                            <td>
                                @Request.ServerVariables["APPL_PHYSICAL_PATH"]
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div region="south" border="false" class="cs-south">
    </div>
    <div id="mm" class="easyui-menu cs-tab-menu">
        <div id="mm-tabupdate">
            刷新</div>
        <div class="menu-sep">
        </div>
        <div id="mm-tabclose">
            关闭</div>
        <div id="mm-tabcloseother">
            关闭其他</div>
        <div id="mm-tabcloseall">
            关闭全部</div>
    </div>
</body>
</html>
